const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  // 解决使用build打包构建后可以在浏览器看到源码的问题
  productionSourceMap: false,
  transpileDependencies: true,
  chainWebpack: config => {
    config
      .plugin('html')
      .tap(args => {
        args[0].title = '书籍管理系统'
        return args
      }
      )
  },
  lintOnSave: false,
  devServer: {
    open: false,
    https: false,
    liveReload: true,
    hot: true,
    proxy: {
      // re stand for redirect
      "/re": {
        // target: 'http://192.168.100.102:32398/',
        // target: 'http://127.0.0.1:5000/',
        target: 'http://39.105.117.99:5000/',
        // target: 'http://192.168.199.159:5000/',
        // target: 'http://192.168.17.248:5000/',
        secure: false,
        changeOrigin: true,
        pathRewrite: {
          "^/re": '/'
        }
      }
    }
  },
  configureWebpack: config => {
    // 为生产环境修改配置...
    if (process.env.NODE_ENV === 'production') {
      config.mode = 'production';
      // 打包文件大小配置
      config.performance = {
        maxEntrypointSize: 10000000,
        maxAssetSize: 30000000
      }
    }
  }
})
